<template>
  <div class="tableAuto">
    <el-table :data="tableData" style="width:100%" :height="height" @row-click="rowClick" border stripe
      :header-cell-style="{background:'#EAEBEC'}" v-loading="tableLoading" ref="refTable" highlight-current-row @sort-change='sortChange'>
      <el-table-column prop="gjcs" min-width="160" show-overflow-tooltip :label="$t('model.canshu_gjcs')"></el-table-column>
      <el-table-column prop="xs" width="220" show-overflow-tooltip :label="$t('model.canshu_xs')"></el-table-column>
      <el-table-column prop="bzhxs" width="160" show-overflow-tooltip :label="$t('model.canshu_bzhxs')"></el-table-column>
      <el-table-column prop="pz" width="160" show-overflow-tooltip :label="$t('model.canshu_pz')"></el-table-column>
      <el-table-column prop="vif" width="120" show-overflow-tooltip :label="$t('model.canshu_vip')"></el-table-column>
      <el-table-column prop="mbmc" width="160" show-overflow-tooltip :label="$t('model.target_col')"></el-table-column>
    </el-table>
  </div>
</template>
<script>
export default {
  data () {
    return {
      radioId: "",
      height: document.body.offsetHeight - 210,
      nolineType: [
        { label: '平方', value: '平方' },
        { label: '对数', value: '对数' },
        { label: '指数', value: '指数' },
        { label: '平方根', value: '平方根' },
      ],
      optimizeList: [
        { label: '最大值', value: '最大值' },
        { label: '最小值', value: '最小值' },
        { label: '指定值', value: '指定值' },
      ],
      wrList: [{
        label: "读写",
        value: 0
      }, {
        label: "只读",
        value: 1
      }, {
        label: "只写",
        value: 2
      }],
      tableData: [
        { 'gjcs': 'Intercept', 'xs': '5.735415', 'bzhxs': '2.287916', 'pz': '1.027087', 'vif': '', 'mbmc': '水分含量', },
        { 'gjcs': '温度', 'xs': '-0.10672', 'bzhxs': '-0.80041', 'pz': '1.361586', 'vif': '1', 'mbmc': '水分含量', },
        { 'gjcs': '喂料量_CE_振动频率', 'xs': '0.038226', 'bzhxs': '2.287916', 'pz': '4.831111', 'vif': '1.535244', 'mbmc': '水分含量', },
        { 'gjcs': '喂料量_CE_风速', 'xs': '-3.38611', 'bzhxs': '2.287916', 'pz': '0.000266', 'vif': '1.535244', 'mbmc': '水分含量', },
      ],
    }
  },
  props: {
    // tableData: Array,
    pager: Object,
    tableLoading: Boolean
  },
  methods: {
    rowClick (row) {
      this.radioId = row.woId;
      let obj = {
        row: row,
        radioId: this.radioId,
      }
      this.$emit("handleEdit", obj)
      this.$refs.refTable.setCurrentRow(row);
    },
    sortChange (column) {
      this.$emit('sortChange', column)
    },
    table_index (index) {
      return (this.pager.pageNum - 1) * this.pager.pageSize + index
    },
    getwrName (id) {
      if (!id && id !== 0) return ''
      return this.wrList.find(item => parseInt(item.value) == id).label
    },

  }
}
</script>
<style scoped>
.bai {
  color: #fff;
}
.tableAuto {
  margin-top: 10px;
}
</style>